home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
TCL1
/
__MANDEL
/
MANDELBR
/
CMANDELT.C
< prev
next >
Wrap
Text File
|
1992-03-25
|
1KB
|
55 lines
// CMandelTextFile.c
#include "CMandelDoc.h"
#include "CMandelTextFile.h"
char *CMandelTextFile::cFormats[] = {
"origin (a, b): %Lg, %Lg\n",
"view rect (width, height): %d, %d\n",
"view depth: %d\n",
"scale: %Lg\n",
"dwell limit: %d\n"
};
void
CMandelTextFile::IMandelTextFile(CMandelDoc *theMandelDoc)
{
CStdioFile::IStdioFile();
itsMandelDoc = theMandelDoc;
}
void
CMandelTextFile::WriteAll(Handle theDataH)
{
TMandelInfo aInfoRec;
itsMandelDoc->GetMandelInfo(&aInfoRec);
printf(cFormats[0], aInfoRec.fHOrigin, aInfoRec.fVOrigin);
printf(cFormats[1], aInfoRec.fWidth, aInfoRec.fHeight);
printf(cFormats[2], 32);
printf(cFormats[3], aInfoRec.fScale);
printf(cFormats[4], aInfoRec.fMaxDwell);
}
Handle
CMandelTextFile::ReadAll(void)
{
TMandelInfo aInfoRec;
int aCount = 0;
aCount += scanf(cFormats[0], &aInfoRec.fHOrigin, &aInfoRec.fVOrigin);
aCount += scanf(cFormats[1], &aInfoRec.fWidth, &aInfoRec.fHeight);
aCount += scanf(cFormats[2], &aInfoRec.fDepth);
aCount += scanf(cFormats[3], &aInfoRec.fScale);
aCount += scanf(cFormats[4], &aInfoRec.fMaxDwell);
if (aCount != 7)
Failure(readErr, 0);
itsMandelDoc->SetMandelInfo(&aInfoRec);
itsMandelDoc->DoGenerate();
return NULL;
}